package com.service.impl;

import com.mapper.RoomMapper;
import com.pojo.Room;
import com.service.RoomService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2017/3/27.
 */
@Service
public class RoomServiceImpl implements RoomService {
    @Resource
    private RoomMapper roomMapper;
    @Override
    public boolean addRoom(Room room) {return roomMapper.insert(room)>0?true:false;}

    @Override
    public boolean delRoomById(Integer roomId) {return roomMapper.deleteByPrimaryKey(roomId)>0?true:false;}

    @Override
    public boolean updateRoom(Room room) {return roomMapper.updateByPrimaryKey(room)>0?true:false;}

    @Override
    public Room findRoomById(Integer id) {
        return roomMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Room> findAllRoom() {
        return roomMapper.selectAll();
    }
}
